package lab3.client.core;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import lab3.server.core.User;



/**
 * To hold user option (menu options). Ugly hardcoded
 * @author hajo
 *
 */

// DON'T TOUCH BELOW THIS -----------------------------------
public final class Options {

   // Keys for up/down load dirs
   public static final String UPLOAD_DIR = "upload";
   public static final String DOWNLOAD_DIR = "download";
   
   private static Connection connection;
   private static User user;

   // Possible many different dirs...
   private static final Map<String, File> dirs = new HashMap<String, File>();

   static {
      dirs.put(UPLOAD_DIR, new File("upload"));
      dirs.put(DOWNLOAD_DIR, new File("download"));
   }

   private Options() {
   }

   public static String getRegistryIp() {
      return connection.getRegistryIp();
   }

   public static int getRegistryPort() {
      return connection.getRegistryPort();
   }

   public static int getMyPort() {
      return connection.getMyPort();
   }

   // User immutable
   public static User getUser() {
      return user;
   }

   public static void put(String key, File file) {
      dirs.put(key, file);
   }

   public static File get(String key) {
      return dirs.get(key);
   }

   public static void setConnection(String registryIp, int registryPort,
         int myPort) {
      connection = new Connection(registryIp, registryPort, myPort);
   }

   public static void setUser(String name, String passwd) {
      user = new User(name, passwd);
   }
}
